function yinshqm
m=20;n=30;w=20;
x=linspace(-4,4,m);
y=linspace(-4,4,n);
z=linspace(-4,4,w);
[x,y,z]=meshgrid(x,y,z);
subplot(1,2,1)
v=f(x,y,z);
h=patch(isosurface(x,y,z,v,0));
set(h,'facecolor','r','edgecolor','k')
daspect([1 1 1])
view(3)
camlight; lighting phong
subplot(1,2,2)
v=f1(x,y,z);
h=patch(isosurface(x,y,z,v,0));
set(h,'facecolor','r','edgecolor','k')
daspect([1 1 1])
view(3)
camlight; lighting phong
print -djpeg -r300 ͼƬ3
function v=f(x,y,z)
v=x.^2-y.^2-z.^2-1;
function v=f1(x,y,z)
v=x.^2+y.^2-z.^2-1;